/*
 * Copyright (c) 2008 Benoit Bouchez, Nicolas Giard
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package com.noocodecommit.wicket.stuff.jquery.plugin.ui.progressbar;

import com.noocodecommit.wicket.stuff.jquery.plugin.JQPluginOptions;

/**
 * JQAccordion Option set
 * 
 * @author Benoit Bouchez
 * 
 */
public class JQProgressBarOptions extends JQPluginOptions implements Cloneable
{
	private int duration = 3000;
	private int increment = 1;
	private int interval = 200;
	private int width = 300;
	private boolean range = true;
	private String text = "";
	private String textClass = "";

	private String startScript = "";
	private String pauseScript = "";
	private String progressScript = "";
	private String stopScript = "";

	/**
	 * Constructor
	 */
	public JQProgressBarOptions()
	{
		super();
		this.setDefaultHeader("progressbar");
	}

	/**
	 * Gets the duration value
	 * 
	 * @return the duration value
	 */
	public int getDuration()
	{
		return duration;
	}

	/**
	 * Sets the duration option value
	 * 
	 * @param duration
	 *            progressbar duration
	 */
	public void setDuration(int duration)
	{
		this.duration = duration;
		this.options.put("duration", "duration:" + duration);
	}

	/**
	 * Gets the increment value
	 * 
	 * @return the increment value
	 */
	public int getIncrement()
	{
		return increment;
	}

	/**
	 * Sets the increment option value
	 * 
	 * @param increment
	 *            progressbar increment
	 */
	public void setIncrement(int increment)
	{
		this.increment = increment;
		this.options.put("increment", "increment:" + increment);
	}

	/**
	 * Gets the interval value
	 * 
	 * @return the interval value
	 */
	public int getInterval()
	{
		return interval;
	}

	/**
	 * Sets the interval option value
	 * 
	 * @param interval
	 *            progressbar interval
	 */
	public void setInterval(int interval)
	{
		this.interval = interval;
		this.options.put("interval", "interval:" + interval);
	}

	/**
	 * Gets the width value
	 * 
	 * @return the width value
	 */
	public int getWidth()
	{
		return width;
	}

	/**
	 * Sets the width option value
	 * 
	 * @param width
	 *            progressbar width
	 */
	public void setWidth(int width)
	{
		this.width = width;
		this.options.put("width", "width:" + width);
	}

	/**
	 * Gets the range value
	 * 
	 * @return the range value
	 */
	public boolean isRange()
	{
		return range;
	}

	/**
	 * Sets the range option value
	 * 
	 * @param range
	 *            progressbar range
	 */
	public void setRange(boolean range)
	{
		this.range = range;
		this.options.put("range", "range:" + range);
	}

	/**
	 * Gets the text value
	 * 
	 * @return the text value
	 */
	public String getText()
	{
		return text;
	}

	/**
	 * Sets the text option value
	 * 
	 * @param text
	 *            progressbar text
	 */
	public void setText(String text)
	{
		this.text = text;
		this.options.put("text", "text:'" + text + "'");
	}

	/**
	 * Gets the textClass value
	 * 
	 * @return the textClass value
	 */
	public String getTextClass()
	{
		return textClass;
	}

	/**
	 * Sets the textClass option value
	 * 
	 * @param textClass
	 *            progressbar textClass
	 */
	public void setTextClass(String textClass)
	{
		this.textClass = textClass;
		this.options.put("textClass", "textClass:'" + textClass + "'");
	}

	/**
	 * Gets the start script value
	 * 
	 * @return the start function
	 */
	public String getStartScript()
	{
		return startScript;
	}

	/**
	 * Sets the start function
	 * 
	 * @param startScript
	 *            progressbar start function
	 */
	public void setStartScript(String startScript)
	{
		this.startScript = startScript;
		this.options.put("start", "start:function(e, ui){" + startScript + "}");
	}

	/**
	 * Gets the pause script value
	 * 
	 * @return the pause function
	 */
	public String getPauseScript()
	{
		return pauseScript;
	}

	/**
	 * Sets the pause function
	 * 
	 * @param pauseScript
	 *            progressbar pause function
	 */
	public void setPauseScript(String pauseScript)
	{
		this.pauseScript = pauseScript;
		this.options.put("pause", "pause:function(e, ui){" + pauseScript + "}");
	}

	/**
	 * Gets the progress script value
	 * 
	 * @return the progress function
	 */
	public String getProgressScript()
	{
		return progressScript;
	}

	/**
	 * Sets the progress function
	 * 
	 * @param progressScript
	 *            progressbar progress function
	 */
	public void setProgressScript(String progressScript)
	{
		this.progressScript = progressScript;
		this.options.put("progress", "progress:function(e, ui){" + progressScript + "}");
	}

	/**
	 * Gets the stop script value
	 * 
	 * @return the stop function
	 */
	public String getStopScript()
	{
		return stopScript;
	}

	/**
	 * Sets the stop function
	 * 
	 * @param stopScript
	 *            progressbar stop function
	 */
	public void setStopScript(String stopScript)
	{
		this.stopScript = stopScript;
		this.options.put("stop", "stop:function(e, ui){" + stopScript + "}");
	}

	@Override
	protected Object clone() throws CloneNotSupportedException
	{
		JQProgressBarOptions clone = (JQProgressBarOptions) super.clone();
		return clone;
	}

}
